<!DOCTYPE html>
<html xmlns:layout="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
	layout:decorate="~{common/layout}">

<head>
	<meta charset="UTF-8">
	<title>在线测验系统</title>
	<style scoped lang="less">
	.el-collapse-item-title {
	    width: 90%;
	    overflow: hidden;
	    text-overflow: ellipsis;
	    white-space: nowrap;
	}
	</style>
</head>

<body>
	<div layout:fragment="fragment_body">
		<van-row>
			<van-nav-bar title="" left-text="返回" left-arrow @click-left="onClickLeft" />
		</van-row>
		<van-row>
			<van-cell>
			  <el-collapse accordion>
				  <el-collapse-item v-for="(data, index) in datas">
				    <template slot="title">
				      <div class="el-collapse-item-title">
						  <el-tag v-if="data.respResult === 1" type="success" effect="plain">正确</el-tag>
						  <el-tag v-if="data.respResult === 0" type="danger" effect="plain">错误</el-tag>
					  {{ data.topicTitle }}</div>
				    </template>
				    <div v-if="data?.topicType*1 < 2">
						<b>选项：</b><br>
				    	<van-checkbox-group v-model="data.respAnswers" class="answer-group">
						  <van-checkbox :name="option.optionId" v-for="option in data.options">
									{{option.optionText}}
						  </van-checkbox>
						</van-checkbox-group>
						<p><b>参考答案：</b>{{data.topicAnswers}}</p>
				    </div>
				    <div v-if="data?.topicType*1 == 2">
					<p><b>参考答案：</b>{{data.topicAnswer}}</p>
					<p><b>你的回答：</b>{{data.respAnswer}}</p>
					 </div>
				    <div><b>解析：</b>{{data.topicAnalysis}}</div>
				  </el-collapse-item>
				</el-collapse>
		  </van-cell>
		</van-row>
		<van-empty v-if="datas == null || datas.length == 0" description="暂无数据" />
	</div>
</body>
<script type="text/javascript" layout:fragment="fragment_script">
	let vueData = {
		activeMenu: 'my',
		activeNames: ['1'],
		value: '',
		datas: [],
		query:{
			type: 0,
			result: 0,
			accountId: getLoginId()
		}
	}
	let vueMethods = {
		onClickLeft() {
			window.location.href = '/user/my'
		},
		getWrongs() {
			let that = this
			postRequst('/user/getWrongs', that.query, true).then(function (resp) {
				that.datas = resp.rows
			})
		},
	}
	function vueCreated() {
		let that = this
		that.getWrongs()
	}
</script>

</html>